import 'package:dio/dio.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

import '../util.dart';
import 'net_exception.dart';

class NetErrorInterceptor extends Interceptor {
  @override
  void onError(DioError err, ErrorInterceptorHandler handler) {
    NetException exception = NetException.create(err);
    Get.log('DioError====: ${exception.toString()}');
    EasyLoading.showError(exception.toString());
    // if (EasyLoading.isShow) {
    //   EasyLoading.dismiss();
    // }
    super.onError(err, handler);
  }
}
